set term postscript

#lorentz(x)=c/((x-a)*(x-a)+b)+d
lorentz(x) = a+b*x/((x*x - f*f + f*f /(2*Q)**2)**2+f**4/ Q**2)**0.5
set xrange [2325.5:2333.5]
a=0.35
b=.1
f=2329.5
Q=8500
fit lorentz(x) 'sweep.tsv' via a,b,f,Q
set output 'cavity-resonance.eps'
plot lorentz(x), 'sweep.tsv' w l

set xrange [2301:2305]
a=.01
b=.1
f=2303
Q=2580
fit lorentz(x) 'sweep.tsv' via a,b,f,Q
set output 'plasma-resonance.eps'
plot lorentz(x), 'sweep.tsv' w l
